<div class="modal fade " id="addFileInfoModal" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="box box-info">
            <div class="box-header with-border">
                <h3 class="box-title">交换模板配置</h3>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form class="form-horizontal" id="addExchangeInfoForm">
                <div class="box-body">
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">数据文件</label>
                        <div class="col-sm-7">
                            <select id="addFileInfoModal_dataFileId" class=" form-control select2" style="width: 300px">
                                <option value="1">1</option>
                            </select>
                        </div>
                    </div>
                </div>
                <!-- /.box-body -->
                <div class="box-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>

                    <button type="button" class="btn btn-primary pull-right" onclick="addFileInfoModal_save()">新增</button>
                </div>
                <!-- /.box-footer -->
            </form>
        </div>
    </div>
</div>
<script>
    function addFileInfoModalInit() {
        $("#addFileInfoModal_dataFileId").empty();
    }

    function addFileInfoModalSetValue() {
        var data = queryParams2() ;
        var url = "/custdatafile/nfile/list?custDataFileId=" +data.custDataFileId;
        getReq(url, function (result) {
            for(var i=0;i<result.length;i++){
                $("#addFileInfoModal_dataFileId").append("<option value='"+result[i].id+"'>"+result[i].name+"</option>") ;
            }
            $("#addFileInfoModal_dataFileId").select2();
        }) ;
    }

    function addFileInfoModal_save() {
        var data = {
            dataFileId: $("#addFileInfoModal_dataFileId").val(),
            custDataFileId: queryParams2().custDataFileId
        };
        var url = "/custdatafile/file/add";
        postReq(url, data, function (result) {
            if (result.success) {
                toastr['success']('操作成功', '提示');
                $("#table2").bootstrapTable("refresh");
                $("#addFileInfoModal").modal("hide");
            } else {
                toastr['error'](result.msg, '提示');
            }
        });

    }
</script>